<template>
  <el-main>
    <el-col>
      <el-row style="font-size:1.25rem;width: 10rem" type="flex" justify="center">
<!--        <span> 外部救援物资名单 </span>-->
        <!--      <dv-decoration-3 style="width:5rem;height:1.25rem;"/>-->
      </el-row>
      <el-row class="supplies-echar">
        <dv-scroll-board :config="config"/>

<!--        <ul>-->
<!--          <li v-for="detail in data">{{ detail }}</li>-->
<!--        </ul>-->
      </el-row>
    </el-col>

  </el-main>
</template>

<script>
export default {
  name: "MessageList",
  data () {
    return {
      options: {},
      config: {
        header: [],
        data: [
          ['浙江富阳', '蔬菜', '100万斤']
        ],
        rowNum: 8, //表格行数
        headerHeight: 80,
        // headerBGC: '#171057', //表头
        // oddRowBGC: '#113af5', //奇数行
        // evenRowBGC: '#2895b9', //偶数行
        index: true,
        columnWidth: [50],
        align: ['right']
      },
      timer: null
    }
  },
  components: {},
  watch: {
    config: {
      handler (newData) {
        this.options = {
          calculable: true,
          series: [
            {
              data: newData.data
            }
          ]
        }
      },
      immediate: true,
      deep: true
    }
  },
  created () {

    this.getData(1);
    // this.timer=setInterval(() => {
    //  this.getData();
    // },1000000
    // );
  },
  beforeDestroy () {
    if (this.timer) { //如果定时器还在运行 或者直接关闭，不用判断
      clearInterval(this.timer) //关闭
    }
  },
  mounted () {},
  methods: {
    getData (id) {
      var _this = this
      id = 1;
      // this.$http.get('feedback/getList').then(response => {
        this.$http.get('http://honglitech.cn:8004/feedback/getList').then(response => {
        // console.log("后端返回："+JSON.stringify(response))
        var data = response.data
        if (data.code == 200) {
          var values = new Array()
          for (var i = 0; i < data.data.length; i++) {
            values[i] = [data.data[i].name, data.data[i].phone, data.data[i].message]
          }
          _this.config = {
            header: ['名字', '联系方式', '留言'],
            data: values,
            rowNum: 5, //表格行数
            headerHeight: 35,
            // headerBGC: '#171057', //表头
            // oddRowBGC: '#113af5', //奇数行
            // evenRowBGC: '#2895b9', //偶数行
            index: true,
            columnWidth: [50,30,60,500],
            waitTime: 500,
            align: ['center']
          }
        } else {
          console.log('失败')
        }
      })
    }
  }
}
</script>

<style scoped>
  .supplies-echar{
    width: 25rem;
    height: 15rem;
  }
  .scroll-board{
    /*width: 80rem;*/
    /*height: 70rem;*/
    padding-top: 3rem;
  }
</style>
